package com.guyj.baseproject.designpatterns.observer;

import com.guyj.lib_common.utils.LogUtils;

import java.util.Observable;
import java.util.Observer;

/**
 * Created by guyj on 2019/9/6.
 * 描述: 观察者类
 */

public class MyObserver implements Observer {
	private String name;

	public MyObserver(String name) {
		this.name = name;
	}

	@Override
	public void update(Observable o, Object arg) {
		LogUtils.i(this.toString() + " 监听到 " + o.toString() + ":arg=" + arg);
	}

	@Override
	public String toString() {
		return "观察者[" + name + "]";
	}
}
